package cn.tianjindong.blog.pojo;

import java.text.SimpleDateFormat;
import java.util.Date;

public class BlogArticleComment {
	private Long id;

	private Long articleId;

	private Date createtime;

	private Long userId;

	private String content;

	private BlogUser user;

	private BlogArticle article;

	private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
	private static SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public BlogUser getUser() {
		return user;
	}

	public void setUser(BlogUser user) {
		this.user = user;
	}

	public Long getId() {
		return id;
	}

	public BlogArticle getArticle() {
		return article;
	}

	public void setArticle(BlogArticle article) {
		this.article = article;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getArticleId() {
		return articleId;
	}

	public void setArticleId(Long articleId) {
		this.articleId = articleId;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content == null ? null : content.trim();
	}

	public String getStringCreatetime() {
		if (createtime != null) {
			return dateFormat.format(createtime);
		}
		return null;
	}

	public String getStringDetailCreatetime() {
		if (createtime != null) {
			return dateFormat2.format(createtime);
		}
		return null;
	}

	public String getBriefContent() {
		if (content != null && this.content.length() > 15) {
			return this.content.substring(0, 15) + "...";
		}
		return this.content;
	}

}